package com.xgimi.open.skill.datamanager.biz.utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author coderzpw.zhang
 * @version 1.0
 * @description 描述
 * @date 2022/12/27 15:31
 */
public class DateUtil {
    public static final String PATTERN = "yyyy-MM-dd HH:mm:ss";

    public static SimpleDateFormat getSdf() {
        return new SimpleDateFormat(PATTERN);
    }

    /**
     * Date 转成 String
     *
     * @param date
     * @return
     */
    public static String format(Date date) {
        return getSdf().format(date);
    }

    /**
     * String 转成 Date
     *
     * @param strDate
     * @return
     * @throws ParseException
     */
    public static Date parse(String strDate) throws ParseException {
        return getSdf().parse(strDate);
    }

}
